<div id="ContentMessage">
	<div id="NoteContentMessage">
		<?php echo $get_message_notnull ?>
	</div>
	
	<div id="ErrorContentMessage">
		<?php echo $lbl_error_msg; ?>
	</div>
</div>
<style type="text/css">
	.ViewStyle01 td.key {background:#CCC;text-align:right;}
</style>	
<form  name='form_main' id="form_main" method="post" action="<?php echo $link_page; ?>" enctype="multipart/form-data">	
<div id="SiteContent_main">			
	<div id="EditContent">
		<p><b><?php echo $lbl_order_infomation ?></b></p>
		<table class="ViewStyle01" width="100%" cellspacing="1">
			<tr>
				<td style="width:200px" class="key"><?php echo $lbl_ccode ?></td>
				<td style="width:250px"><?php echo $obj_order_view['ccode'] ?></td>
				<td style="width:200px" class="key"><?php echo $lbl_caddress ?></td>
				<td><?php echo $obj_order_view['caddress'] ?></td>
			</tr>
			<tr>
				<td style="width:200px" class="key"><?php echo $lbl_cfullname ?></td>
				<td style="width:250px"><?php echo $obj_order_view['cfullname'] ?></td>
				<td style="width:200px" class="key"><?php echo $lbl_date01 ?></td>
				<td><?php echo Fview_date($obj_order_view['ddate01']) ?></td>
			</tr>
			<tr>
				<td style="width:200px" class="key"><?php echo $lbl_nphone ?></td>
				<td style="width:250px"><?php echo $obj_order_view['nphone'] ?></td>
				<td style="width:200px" class="key"><?php echo $lbl_date02 ?></td>
				<td><?php echo Fview_date($obj_order_view['ddate02']) ?></td>
			</tr>
			<tr>
				<td style="width:200px" class="key"><?php echo $lbl_cemail ?></td>
				<td style="width:250px"><?php echo $obj_order_view['cemail'] ?></td>
				<td style="width:200px" class="key"><?php echo $lbl_cnote ?></td>
				<td><?php echo $obj_order_view['cnote'] ?></td>
			</tr>
		</table>
		<p><b><?php echo $lbl_product_infomation ?></b></p>
		<table class="ViewStyle01" width="100%" cellspacing="1">
			<thead>
				<tr>
					<th style="width:100px"><?php echo $lbl_ccode ?></th>
					<th><?php echo $lbl_cproduct ?></th>
					<th style="width:100px"><?php echo $lbl_nquantity ?></th>
					<th style="width:200px"><?php echo $lbl_fprice ?></th>
					<th style="width:200px"><?php echo $lbl_ftotal ?></th>
				</tr>
			</thead>
			<tbody>
				<?php 
					$total = 0;
					foreach($obj_order_detail as $data): 
					$product	= get_product_byid($data['nid_product']);
					if($product['fprice_sale'] != 0 && $product['fprice_sale'] != '')
						$total += $data['nquantity'] * $product['fprice_sale'];
					else
						$total += $data['nquantity'] * $product['fprice'];
				?>
				<tr>
					<td><?php echo Fview_text($product['ccode']) ?></td>
					<td><?php echo Fview_text($product['cproducts']) ?></td>
					<td style="text-align:right"><?php echo Fview_text($data['nquantity']) ?></td>
					<td style="text-align:right">
						<?php 
							if($product['fprice_sale'] != 0 && $product['fprice_sale'] != '')
								echo Fview_text(number_format($product['fprice_sale'])).' '.$lbl_vnd.' <span style="text-decoration:line-through; color:#ff0000;">('.number_format($product['fprice']).')</span> ';
							else
								echo Fview_text(number_format($product['fprice'])).' '.$lbl_vnd;
						?>
					</td>
					<td style="text-align:right">
					<?php 
						if($product['fprice_sale'] != 0 && $product['fprice_sale'] != '')
							echo Fview_text(number_format($data['nquantity']*$product['fprice_sale'])).' '.$lbl_vnd;
						else
							echo Fview_text(number_format($data['nquantity']*$product['fprice'])).' '.$lbl_vnd;
						
					?>
					</td>
				</tr>
			<?php endforeach; ?>
				<tr>
					<td colspan="4" style="text-align:right"><b><?php echo $lbl_fsum ?> : </b></td>
					<td style="text-align:right"><b><?php echo Fview_text(number_format($total)).' '.$lbl_vnd ?></b></td>
				</tr>
			</tbody>		
		</table>
		
		<table class="EditStyle01" >
			<tbody>								               
                <tr>
					<td class="key" width="150" align="right"><?php echo $lbl_nid_order_status; ?>				</td>
					<td width="400"><?php echo $gencbo_order_status_list ;?></td>
				</tr>
			<tbody>				
		</table>
		<div style="margin:15px 0;">
			<input type="button" name="btn_submit" style="width:80px;" value ="<?php echo $btn_update; ?>" 
							onclick ="js_SetSubmitButtonClick(this.form, this.name);" class="button"/>
													   
						<input name="btn_cancel" style="width:80px;" type="button" 
							   value = "<?php echo $btn_cancel; ?>"
							   onclick="location.href='<?php echo $link_cancel; ?> '" class="button"/>	
		</div>
	</div>
	<input name="hidden_nid" type="hidden" value = "<?php echo $nid; ?>"  />
	<input name="hidden_event" type="hidden" value = "<?php echo $event; ?>"  />
	<input type="hidden" name="hidden_button_click"  value = "" />	
</div>
</form>

<!-- BAT BUOC CAC FORM NHAP LIEU DEU PHAI DUNG SCRIPT NAY. -->

<script type="text/javascript" >
function js_SetSubmitButtonClick(obj_form, btn_name) 
	{
		obj_form.hidden_button_click.value = btn_name;
		obj_form.submit();		
	}	

</script>